<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>3-5 flex 给子元素设置伸缩比例 flex-shrink </title>
	</head>


	<!--
	 
	3.5-2 其他属性
	对子对象设置的,
	flex-bsis  设置弹性盒子 伸缩基准值 
	
	flex-grow  设置弹性盒子的扩展比率
	flex-shrink  设置弹性盒子的缩小比率 
	
	
	
	 简写方式
	flex :  flex-grow  flex-shrink flex-bsis 
	
	 -->

	<style>
		* {
			margin: 0;
			padding: 0;
			box-sizing: content-box;
		}

		.container {
			color: red;
			font-size: 25px;
			width: 400px;
			height: 500px;

			/* 父元素 flex 布局 */
			display: flex;
			flex-direction: row;
			background-color: pink;
		}

		.container div {
			width: 200px;
			height: 100px;
			background-color: lightyellow;
		}


		/* 
		
		
		超出的部分
		(300+ 300) - 400 = 200px 
		
		分成4分，一份是 50px 
		200  / (1+3) = 50 
		 
		300 - 50  = 250
		
		300 -150  = 150
		 */

		div:nth-child(1) {
			/* 设置基准值后 ， width 将不在生效了 */
			flex-basis: 300px;
			flex-shrink: 1;
			/* background-color: #555; */
		}

		div:nth-child(2) {
			flex-basis: 300px;
			flex-shrink: 3;
			/* background-color: #ccc; */
		}

		div {}
	</style>


	<body>





		<div class="container">

			<div>1</div>
			<div>2</div>
			<!-- <div>3</div> -->
			<!-- <div>4</div> -->


		</div>

	</body>
</html>
